{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "df = pd.read_csv('data.csv', header=0)\n",
    "df_dropped = df.drop(columns=\"CUST_ID\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_dropped = df_dropped.apply(lambda x: x.fillna(x.mean()), axis=0)\n",
    "df_dropped = df_dropped.apply(lambda x: (x-x.mean())/x.std())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "8950"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(df_dropped)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "8950\n"
     ]
    }
   ],
   "source": [
    "data = df_dropped.values\n",
    "print(len(data))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[3, 4]\n"
     ]
    }
   ],
   "source": [
    "x = [1,2,3,4]\n",
    "print(x[2:9])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [],
   "source": [
    "n = 0\n",
    "kirat_arrays = []\n",
    "for i in range(19):\n",
    "    c_array = \"double kirat_data\"+str(n)+\"[n][dim] = {\"\n",
    "    for row in df_dropped.values[n*100:(n*100+50)]:\n",
    "        row_str = \"{\"\n",
    "        for coord in row:\n",
    "            row_str += str(coord) + ','\n",
    "        row_str = row_str[:-1] + \"}\"\n",
    "        c_array += row_str + ','\n",
    "    c_array = c_array[:-1]+'}'\n",
    "    c_array += ';\\n'\n",
    "    c_array += \"status = storeData(global_eid, &ptr, (double*)kirat_data\"+str(n)+\", dim, n);\"\n",
    "\n",
    "    kirat_arrays.append(c_array)\n",
    "    n+=1\n",
    "# file1 = open(\"data.txt\",\"a\") \n",
    "# file1.write(c_array)\n",
    "# file1.close()\n",
    "        "
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
